﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace UI.ProductManagement
{
    public partial class FrmPot0a00 : UI.ParentForm.BaseMain
    {
        FrmPot0a00Edit edit = null;

        public FrmPot0a00(string modulecode, string action)
            : base(modulecode, action)
        {
            InitializeComponent();
        }

        protected override void OnAddClick(ToolStripButton btn)
        {
            edit = new FrmPot0a00Edit("A", GetTitleStyle(this.Text, btn.Text), "");
            edit.ShowDialog();
            if (edit.IsReload) base.BindGrid();
        }

        protected override void OnEditClick(ToolStripButton btn, DataGridViewRow row)
        {
            OpenEdit("M", btn.Text, Components.Validation.ToString(row.Cells["listid"].Value));
        }

        protected override void OnViewClick(ToolStripButton btn, DataGridViewRow row)
        {
            OpenEdit("V", btn.Text, Components.Validation.ToString(row.Cells["listid"].Value));
        }

        private void OpenEdit(string action, string btnText, string code)
        {
            edit = new FrmPot0a00Edit(action, GetTitleStyle(this.Text, btnText), code);
            edit.ShowDialog();
            if (edit.IsReload) base.BindGrid();
        }

        protected override void UpdatePager(UI.Common.Pager pager)
        {
            pager.FilterAppName = "muser";
            pager.StrWhere = "a.status = '01'";
        }

    }
}
